home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / Tools Plus 2.5 / Tools Plus 2.5 (C⁄C++ & Pascal) / User Manual / 14-System Polling (3 of 4) < prev    next >
Encoding:
Text File  |  1994-05-24  |  30.3 KB  |  655 lines  |  [TEXT/ttxt]

  1. doNothing (event)
  2. `````````````````
  3. No event has occurred.  Also called a “null event.”
  4.  
  5.   The doNothing event indicates that the event queue is empty and that no event has occurred.  This occurs only when PollSystem returns with a value of false.
  6.  
  7. Programming Considerations
  8. ``````````````````````````
  9. • If your application does “background processing,” that is, it performs
  10.   an on-going process while it is waiting for events, it should perform
  11.   “one cycle” of its background process each time it receives a
  12.   doNothing event.  A single cycle of your application’s background
  13.   process should take no longer than 1/60 of a second.  See the
  14.   SetNullTime routine to set the interval at which your application
  15.   receives doNothing events.
  16.  
  17. • Picture buttons with the “repeating events” option turned on may
  18.   produce doNothing events if your application calls PollSystem more
  19.   frequently than the button changes its value.  This will cause no ill
  20.   side-effects, but you should be aware of this
  21.  
  22. ------------------------------------------------------------------------
  23.  
  24. doChgWindow (event)
  25. ```````````````````
  26. Request to activate an inactive window that belongs to your application.
  27.  
  28.   The request to activate an inactive window is made in response to the user clicking anywhere on an inactive window that belongs to your application.  However, there is one exception.  If the user clicks in an inactive window’s title bar while holding the Command key, the window is dragged without being activated.
  29.  
  30. Programming Considerations
  31. ``````````````````````````
  32. • A window can be activated by using the ActivateWindow procedure.
  33.  
  34. • If the active window has an active editing field, you may want to
  35.   validate the edited text before allowing the user to activate another
  36.   window.  If this is the case, use GetFieldString to obtain a copy of
  37.   the edited text, then your application can check the string for
  38.   errors.  If an error is detected, display an appropriate alert box and
  39.   ignore the doChgWindow event.  If no error is detected, call the
  40.   SaveFieldString procedure to save the edited text as the field’s
  41.   string, then activate the required window.
  42.  
  43. • If your application decides not to allow the user to activate a
  44.   window, it should display an appropriate alert box to explain why.
  45.  
  46. • The doChgWindow event will never occur when a modal window is active,
  47.   or when the watch cursor is displayed since other windows belonging to
  48.   your application cannot be clicked.
  49.  
  50. • A doChgWindow event does not occur if the user clicks on a tool bar or
  51.   floating palettes.
  52.  
  53. • If your application is running under Finder (System 6 or prior), a
  54.   doChgWindow event will not occur when the user [1] clicks a desk
  55.   accessory from an active window, [2] clicks a desk accessory from
  56.   another active desk accessory, or [3] clicks the previously active
  57.   window from an active desk accessory.  These are all handled
  58.   automatically.
  59.  
  60. Valid Polling Record Fields
  61. ```````````````````````````
  62. Poll.Window
  63.  
  64. ------------------------------------------------------------------------
  65.  
  66. doRefresh (event)
  67. `````````````````
  68. A window’s contents need to be refreshed (redrawn).
  69.  
  70.   Your application must respond to this event.  The doRefresh event occurs when a window is completely or partially obscured, then becomes uncovered.  Tools Plus takes care of redrawing buttons, scroll bars, editing fields, list boxes, pop-up menus, picture buttons and custom controls.  Your application must take care of refreshing anything else, such as icons, pictures, lines, or text that it may have put in the window.
  71.  
  72.   When a doRefresh event is reported, the window’s “update region” will define the exact areas that need to be refreshed, excluding the objects drawn by Tools Plus (buttons, scroll bars, editing fields, list boxes, pop-up menu, picture buttons and custom controls).  Although you can redraw everything in the window, only the parts of the window that are visible and which need refreshing will actually be redrawn.
  73.  
  74. Programming Considerations
  75. ``````````````````````````
  76. • When your application detects a doRefresh event, it should respond in
  77.   the following manner:
  78.  
  79.  
  80. CurrentWindow(Poll.Window);            {Make the affected window the   }
  81.                                        {  current grafPort.            }
  82. BeginUpdate(WindowPointer(Poll.Window));{Drawing will occur only within}
  83.                                         {  the area that needs         }
  84.                                         {  refreshing (includes all    }
  85.                                         {  monitors).                  }
  86. for theScreen:=1 to NumberOfScreens do {Repeat drawing for each monitor}
  87.   begin                                {  in which the window appears. }
  88.     BeginUpdateScreen(theScreen);      {Drawing area reduced to the    }
  89.                                        {  specified screen.            }
  90.  
  91.     {   …insert your color-dependent drawing code here…   }
  92.  
  93.     EndUpdateScreen;                   {End the drawing for this       }
  94.                                        {  monitor, and restore the     }
  95.                                        {  window’s visible (drawing)   }
  96.   end;                                 {  region.                      }
  97.  
  98.  {   …insert your color-independent drawing code here…   }
  99.  
  100. EndUpdate(WindowPointer(Poll.Window)); {End the update for the window  }
  101. CurrentWindowReset;                    {Reset the current window to be }
  102.                                        {  the same as the active window}
  103.                                        {  (optional command).          }
  104.  
  105.  
  106. • BeginUpdate temporarily sets the window’s visRgn (visible region where
  107.   drawing occurs) to the intersection of the visRgn and updateRgn
  108.   (region requiring updating).  This effectively restricts drawing to
  109.   the area that needs updating.  Tools Plus removes its own objects
  110.   (buttons, scroll bars, editing fields, list boxes, pop-up menus,
  111.   picture buttons and custom controls) from the updateRgn, so you don’t
  112.   have to worry about accidentally drawing over those objects
  113.  
  114. • If your application did not put anything in the window except buttons,
  115.   scroll bars, editing fields, list boxes, pop-up menus, picture buttons
  116.   and custom controls, all it needs is the BeginUpdate and EndUpdate
  117.   routines.  Note that BeginUpdate and EndUpdate cannot be nested.
  118.  
  119. • It is possible that several windows will need to be refreshed
  120.   simultaneously if, for instance, a closing window exposed three
  121.   windows behind it.  PollSystem reports a single doRefresh event each
  122.   time it is called in the event loop, one event for each window that
  123.   needs refreshing.
  124.  
  125. • Unlike ordinary Macintosh applications, a doRefresh event is not
  126.   generated when a window is first opened.
  127.  
  128. • A doRefresh event is not generated for desk accessories, dialogs,
  129.   alerts, or Dynamic Alerts.  These events are handled automatically.
  130.  
  131. Valid Polling Record Fields
  132. ```````````````````````````
  133. Poll.Window
  134.  
  135. ------------------------------------------------------------------------
  136.  
  137. doGoAway (event)
  138. ````````````````
  139. Request to close the active window.
  140.  
  141.   The request to close the active window is made in response to the user clicking inside the window’s “close” box.  This has the same effect as choosing the File menu’s Close item.
  142.  
  143. Programming Considerations
  144. ``````````````````````````
  145. • A window is closed by using the WindowClose procedure.
  146.  
  147. • If the window has an active editing field, you may want to validate
  148.   its edited text before allowing the user to close the window.  If this
  149.   is the case, use GetFieldString to obtain a copy of the edited text,
  150.   then your application can check the string for errors.  If an error is
  151.   detected, display an appropriate alert box and ignore the doGoAway
  152.   event.  If no error is detected, call the SaveFieldString procedure to
  153.   save the edited text as the field’s string, then close the required
  154.   window.
  155.  
  156. • If any changes have been made in the window’s data, your application
  157.   should display an appropriate alert box and ask the user if changes
  158.   should be saved.  The options should be Yes, No, and Cancel, the last
  159.   of which would ignore the doGoAway event.
  160.  
  161. • If a modal window has a “close” box and the operator types Command-W,
  162.   a doGoAway event is generated for that window.
  163.  
  164. • The doGoAway event will never occur when the watch cursor is
  165.   displayed, since the close box cannot be clicked.
  166.  
  167. • A doGoAway event is not generated when the user clicks a desk
  168.   accessory’s close box.  The desk accessory is closed automatically.
  169.  
  170. • You may want to consider hiding a window (with the WindowDisplay
  171.   routine) instead of closing it in situations where a window is opened
  172.   and closed frequently, such as a floating palette or tool bar.  Hiding
  173.   and showing a window preserves the window’s setting and location, and
  174.   is much faster than opening a window and recreating the user interface
  175.   elements.  However, hiding a window does not release the memory
  176.   consumed by the objects in the window (such as picture buttons, list
  177.   boxes, etc.)
  178.  
  179. Valid Polling Record Fields
  180. ```````````````````````````
  181. Poll.Window
  182. Poll.Modifiers
  183.  
  184. ------------------------------------------------------------------------
  185.  
  186. doButton (event)
  187. ````````````````
  188. Indicator that user has clicked a button.
  189.  
  190.   The doButton event reports that the user has clicked a button in the active window.  This includes push buttons, check boxes and radio buttons.  The doButton event is also reported if the active window has a default push-button, and the user pressed the Return or Enter key to invoke the default.  If this is the case, the window’s default button will already have been “flashed” as if the user had clicked it.
  191.  
  192. Programming Considerations
  193. ``````````````````````````
  194. • If the user clicked a check box, use SelectButton to reverse the check
  195.   box’s selection (i.e. select or deselect it).
  196.  
  197. • If the user clicked a radio button, use SelectButton to select the
  198.   radio button, and to deselect the other buttons in the radio button’s
  199.   group.
  200.  
  201. • This event will never occur when the watch cursor is displayed, since
  202.   buttons cannot be clicked.  The exception is if the WatchCursorButtons
  203.   procedure has been used to allow the watch cursor to click push-
  204.   buttons.
  205.  
  206. • If your application responds to double-clicks in radio buttons and
  207.   Poll.Button.DoubleClick is true, consider the event to mean “click
  208.   button and OK,” in which case the default button should be flashed and
  209.   the appropriate action taken.
  210.  
  211. • A doButton event is not generated when the user clicks buttons in a
  212.   dialog box, alert box, or desk accessory.  These events are handled
  213.   automatically.
  214.  
  215. Valid Polling Record Fields
  216. ```````````````````````````
  217. Poll.Window
  218. Poll.Button.Num
  219. Poll.Button.DoubleClick
  220. Poll.Modifiers
  221.  
  222. ------------------------------------------------------------------------
  223.  
  224. doMenu (event)
  225. ``````````````
  226. Indicator that the user selected a pull-down or hierarchical menu item.
  227.  
  228.   The user selected a pull-down or hierarchical menu by either clicking in the menu bar and selecting an item, or by typing a Command key equivalent for a menu item.
  229.  
  230. Programming Considerations
  231. ``````````````````````````
  232. • The menu’s name in the menu bar is automatically highlighted (white
  233.   letters on black background) when the user makes a menu selection.
  234.   Your application must call MenuHilite(0) to remove the highlighting
  235.   when it is finished with its process.
  236.  
  237. • If a hierarchical menu item is selected, the name of its ultimate
  238.   parent menu is highlighted in the menu bar (white letters on black
  239.   background).  Your application must call MenuHilite(0) to remove the
  240.   highlighting when it is finished with its process.  If a Command key
  241.   equivalent for a hierarchical menu item is typed, and the hierarchical
  242.   menu is not ultimately attached to a pull-down menu, a doKeyDown or
  243.   doAutoKey event is reported instead (as though the hierarchical menu
  244.   did not exist).
  245.  
  246. • This event will never occur when a modal window is active, or when the
  247.   watch cursor is displayed since the menu cannot be clicked and Command
  248.   key equivalents are ignored.
  249.  
  250. • If the active window has an active editing field, PollSystem will
  251.   process the Edit menu’s Undo, Cut, Copy, Paste, and Clear commands
  252.   automatically.  These selections will not generate doMenu events.
  253.  
  254. • A doMenu event is not generated when the user selects desk accessory
  255.   menus.  These selections are handled automatically.
  256.  
  257. Valid Polling Record Fields
  258. ```````````````````````````
  259. Poll.Menu.Num
  260. Poll.Menu.Item
  261. Poll.Modifiers
  262.  
  263. ------------------------------------------------------------------------
  264.  
  265. doKeyDown (event)
  266. `````````````````
  267. Indicator that the user pressed down a key.
  268.  
  269. The user has pressed down a key on the keyboard or numeric pad, and the key cannot be processed internally by Tools Plus.
  270.  
  271. Programming Considerations
  272. ``````````````````````````
  273. • This event is generated only if the key can not be processed
  274.   internally by Tools Plus.
  275.  
  276. • Command key sequences that are equivalents to menu items generate 
  277.   doMenu events.
  278.  
  279. • If a Command key equivalent for a hierarchical menu item is typed, and
  280.   the hierarchical menu is not ultimately attached to a pull-down menu,
  281.   a doKeyDown or doAutoKey event is reported instead (as though the
  282.   hierarchical menu did not exist).
  283.  
  284. • The Modifiers field tells your application if the key down event was a
  285.   Command key sequence.  All Command key sequences that are not menu
  286.   equivalents are returned to your application as doKeyDown or doAutoKey
  287.   events.  If your application gets such a Command key sequence, it
  288.   should carry out the appropriate action, or beep the user if the
  289.   Command key sequence is illegal.
  290.  
  291. • If Return or Enter are typed when the active window has a default
  292.   button, a doButton event is reported for the default button.
  293.  
  294. • If an active editing field exists on the active window, key strokes
  295.   will affect the field and will not generate events.  This applies even
  296.   if the field’s length is limited, or if Return has been disallowed in
  297.   a field.
  298.  
  299. • If Tab is typed and the window contains an active editing field, it
  300.   indicates that the user wants to tab to the next field.  Shift-Tab
  301.   indicates tabbing to the previous field.  You may want to validate a
  302.   field’s edited text before allowing the user to tab to the new field.
  303.   If this is the case, use GetFieldString to obtain a copy of the edited
  304.   text, then your application can check the string for errors.  If an
  305.   error is detected, display an appropriate alert box and ignore the
  306.   doKeyDown event.  If no error is detected, call the SaveFieldString
  307.   procedure to save the edited text as the field’s string, then activate
  308.   the new field by using the ActivateField procedure.
  309.  
  310. • A Return key is reported only if the window does not have a default
  311.   button or active field.
  312.  
  313. • If Enter is typed, it usually indicates that the user wants to enter
  314.   the screen’s data.  This is the same process that is carried out by
  315.   clicking an OK button.  See “Tab” above, regarding validating and
  316.   saving a field’s edited text.  An Enter key is reported only if the
  317.   window does not have a default button.
  318.  
  319. • When the watch cursor is displayed, the only doKeyDown event that will
  320.   be reported is a Command-., which indicates that the user is halting a
  321.   lengthy process.  Other doKeyDown events are discarded.
  322.  
  323. • If the active window has an active editing field, PollSystem
  324.   automatically processes the Command key equivalents for the Edit
  325.   menu’s Undo, Cut, Copy, and Paste commands.  These selections do not
  326.   generate events.
  327.  
  328. • There are two situations where several keys produce the same key
  329.   character: the Clear and Escape keys, and the F1 through F15 keys.  In
  330.   these cases, use the key code to differentiate the keys.  Constants
  331.   are provided for these key characters and key codes.
  332.  
  333. • A doKeyDown event is not generated when the user types in a desk
  334.   accessory.  These key strokes are handled automatically.
  335.  
  336. Valid Polling Record Fields
  337. ```````````````````````````
  338. Poll.Window
  339. Poll.Key.Code
  340. Poll.Key.Chr
  341. Poll.Modifiers
  342.  
  343. ------------------------------------------------------------------------
  344.  
  345. doAutoKey (event)
  346. `````````````````
  347. Indicator that the user held down a key, and it is repeating.
  348.  
  349. The user has pressed down a key on the keyboard or numeric pad, and the key is repeating.  The key cannot be processed internally by Tools Plus.  In most cases, this event should be treated identically to a doKeyDown event.  Each doAutoKey event will follow a doKeyDown of the same sort, so your application may want to make some repeating Command key sequences illegal.
  350.  
  351. Programming Considerations
  352. ``````````````````````````
  353. • This event is generated only if the key can not be processed
  354.   internally by Tools Plus.
  355.  
  356. • Command key sequences that are equivalents to menu items generate
  357.   doMenu events.
  358.  
  359. • If a Command key equivalent for a hierarchical menu item is typed, and
  360.   the hierarchical menu is not ultimately attached to a pull-down menu,
  361.   a doKeyDown or doAutoKey event is reported instead (as though the
  362.   hierarchical menu did not exist).
  363.  
  364. • The Modifiers field tells your application if the repeating key down
  365.   event was a Command key sequence.  All Command key sequences that are
  366.   not menu equivalents are returned to your application as doKeyDown or
  367.   doAutoKey events.  If your application gets such a Command key
  368.   sequence, it should carry out the appropriate action, or beep the user
  369.   if the Command key sequence is illegal.
  370.  
  371. • If Return or Enter are typed and held down when the active window has
  372.   a default button, a doButton event is reported for the default button.
  373.  
  374. • If an active editing field exists on the active window, repeating keys
  375.   will affect the field and will not generate events.  This applies even
  376.   if the field’s length is limited, or if Return has been disallowed in
  377.   a field.
  378.  
  379. • If Tab is typed and the window contains an active editing field, it
  380.   indicates that the user wants to tab to the next field.  Shift-Tab
  381.   indicates tabbing to the previous field.  You may want to validate a
  382.   field’s edited text before allowing the user to tab to the new field.
  383.     If this is the case, use GetFieldString to obtain a copy of the
  384.   edited text, then your application can check the string for errors.
  385.   If an error is detected, display an appropriate alert box and ignore
  386.   the doKeyDown event.  If no error is detected, call the
  387.   SaveFieldString procedure to save the edited text as the field’s
  388.   string, then activate the new field by using the ActivateField
  389.   procedure.
  390.  
  391. • A Return key is reported only if the window does not have a default
  392.   button or active field.
  393.  
  394. • If Enter is typed, it usually indicates that the user wants to enter
  395.   the screen’s data.  This is the same process that is carried out by
  396.   clicking an OK button.  See “Tab” above, regarding validating and
  397.   saving a field’s edited text.  An Enter key is reported only if the
  398.   window does not have a default button.  The repeating Enter key may be
  399.   considered illegal because a doKeyDown event will report the first
  400.   Enter, after which your application should have acted accordingly.  An
  401.   Enter key is reported only if the window does not have a default
  402.   button.
  403.  
  404. • When the watch cursor is displayed, the only doAutoKey event that will
  405.   be reported is a Command-., which is the user’s request to halt a
  406.   lengthy process.  Other doAutoKey events are discarded.
  407.  
  408. • If the active window has an active editing field, PollSystem
  409.   automatically processes the Command key equivalents for the Edit
  410.   menu’s Undo, Cut, Copy, and Paste commands.  These selections do not
  411.   generate events.
  412.  
  413. • There are two situations where several keys produce the same key
  414.   character: the Clear and Escape keys, and the F1 through F15 keys.  In
  415.   these cases, use the key code to differentiate the keys.  Constants
  416.   are provided for these key characters and key codes.
  417.  
  418. • A doAutoKey event is not generated when the user types in a desk
  419.   accessory.  These key strokes are handled automatically.
  420.  
  421. Valid Polling Record Fields
  422. ```````````````````````````
  423. Poll.Window
  424. Poll.Key.Code
  425. Poll.Key.Chr
  426. Poll.Modifiers
  427.  
  428. ------------------------------------------------------------------------
  429.  
  430. doKeyUp (event)
  431. ```````````````
  432. Indicator that the user released a key.
  433.  
  434. The user has released a key on the keyboard or numeric pad, and the key cannot be processed internally by Tools Plus.  Normally the Macintosh does not report doKeyUp events nor do applications typically respond to them.  See “Key-Up Events” in the Designing Your Application chapter for details on the SetEventMask procedure.
  435.  
  436. Programming Considerations
  437. ``````````````````````````
  438. • This event is generated only if your application has used the
  439.   SetEventMask procedure to make the Macintosh respond to key-up events,
  440.   and if the active window does not have an active editing field.
  441.  
  442. • Tools Plus and desk accessories do not require key-up events, and
  443.   therefore ignore them.
  444.  
  445. • There are two situations where several keys produce the same key
  446.   character: the Clear and Escape keys, and the F1 through F15 keys.  In
  447.   these cases, use the key code to differentiate the keys.  Constants
  448.   are provided for these key characters and key codes.
  449.  
  450. • When the watch cursor is displayed, all doKeyUp events are discarded
  451.   and are not generated.
  452.  
  453. Valid Polling Record Fields
  454. ```````````````````````````
  455. Poll.Window
  456. Poll.Key.Code
  457. Poll.Key.Chr
  458. Poll.Modifiers
  459.  
  460. ------------------------------------------------------------------------
  461.  
  462. doClickField (event)
  463. ````````````````````
  464. Indicator that the user clicked in an inactive editing field.
  465.  
  466. When the user clicks in an inactive editing field in the active window, it indicates that the user has finished working with the currently active field and wants to start working with the one that was clicked.  Tools Plus automatically supports the full range of Macintosh user interface options for editing fields, including (but not limited to):
  467.   • clicking in the field, thereby placing an insertion point
  468.   • dragging across characters to create a selection
  469.   • double-clicking a word to select it
  470.  
  471. Programming Considerations
  472. ``````````````````````````
  473. • The ClickInField procedure is used to process a user’s click in an
  474.   inactive editing field.  It could be in the same window that the user
  475.   is working in, or it could be in a tool bar or floating palette
  476.  
  477. • If an editing field is active when you receive a doClickField event,
  478.   you may want to validate its edited text before allowing the user to
  479.   click to the new field.  If this is the case, use GetFieldString to
  480.   obtain a copy of the edited text, then your application can check the
  481.   string for errors.  If an error is detected, display an appropriate
  482.   alert box and ignore the doClickField event.  If no error is detected,
  483.   call the SaveFieldString procedure to save the edited text as the
  484.   field’s string, then call the ClickInField procedure to process the
  485.   user’s click in the new field.
  486.  
  487. • Between the time that the doClickField event is reported and the
  488.   ClickInField procedure is used as a response, observe the following
  489.   rules:
  490.       • do not call PollSystem
  491.       • do not open or close any windows, including alerts and dialogs
  492.       • do not hide or show any windows
  493.       • do not activate any windows.
  494.   If these rules are not observed, ClickInField will do nothing and the
  495.   user’s click is ignored.
  496.  
  497. • An event will not occur if the user clicks in an editing field that is
  498.   already active.
  499.  
  500. • This event will never occur when the watch cursor is displayed, since
  501.   editing fields cannot be clicked.
  502.  
  503. • A doClickField event is not generated when the user clicks in a desk
  504.   accessory’s editing fields.  The process is handled automatically.
  505.  
  506. Valid Polling Record Fields
  507. ```````````````````````````
  508. Poll.Window
  509. Poll.Field
  510. Poll.Modifiers
  511.  
  512. ------------------------------------------------------------------------
  513.  
  514. doScrollBar (event)
  515. ```````````````````
  516. Indicator that user clicked in a scroll bar.
  517.  
  518. The doScrollBar event reports that the user has clicked somewhere in a scroll bar.  The scroll bar has 5 parts: up button, down button, “page up” region, “page down” region, and the thumb.  In all cases, your application should respond to the scroll bar event by scrolling the window’s contents (or portion thereof) and drawing any parts that have been newly revealed due to scrolling.
  519.  
  520. Programming Considerations
  521. ``````````````````````````
  522. • If the scroll bar’s thumb was moved, your application can obtain the
  523.   current value of the scroll bar by calling GetScrollBarVal.  By using
  524.   this value, your application can determine how much to scroll.
  525.  
  526. • If the scroll bar’s up button, down button, “page up” region, or “page
  527.   down” region was clicked, your application must scroll the window by
  528.   the correct amount, then change the scroll bar’s value by using
  529.   SetScrollBarVal.
  530.  
  531. • If the up arrow or “page up” region is clicked, subtract the correct
  532.   amount from the current value.  If the down arrow or “page down”
  533.   region is clicked, add the correct amount to the current value.
  534.  
  535. • If the user holds the mouse button down in the up arrow, “page up”
  536.   region, down arrow, or “page down” region, PollSystem returns a single
  537.   doScrollBar event each time PollSystem is called.  Your application
  538.   doesn’t have to be aware of this, but it is nice to know that scroll
  539.   bar events will not pile up in the queue.
  540.  
  541. • If the user moves the scroll bar’s thumb and returns it to its
  542.   original place during the same drag, an event is not generated.
  543.  
  544. • This event will never occur when the watch cursor is displayed, since
  545.   scroll bars cannot be clicked.
  546.  
  547. • Scroll bars that are part of a list box are handled automatically.
  548.  
  549. • A doScrollBar event is not generated when the user clicks scroll bars
  550.   in a dialog box or desk accessory.  These events are handled
  551.   automatically.
  552.  
  553. Valid Polling Record Fields
  554. ```````````````````````````
  555. Poll.Window
  556. Poll.ScrollBar.Num
  557. Poll.ScrollBar.Part
  558.  
  559. ------------------------------------------------------------------------
  560.  
  561. doListBox (event)
  562. `````````````````
  563. Indicator that user clicked or double-clicked in a list box.
  564.  
  565. The doListBox event reports that the user has clicked somewhere in a list box (on a line that contains text or a blank line).  This event is not generated when the user just scrolls the list box by using its scroll bar.
  566.  
  567. Programming Considerations
  568. ``````````````````````````
  569. • If your application treats double-clicks in list boxes like clicking
  570.   the OK button, use the GetListBoxLine function to determine which line
  571.   was selected (or GetListBoxLines if multiple lines can be selected in
  572.   the list box), then flash the OK button with the FlashButton
  573.   procedure.
  574.  
  575. • This event will never occur when the watch cursor is displayed, since
  576.   list boxes cannot be clicked.
  577.  
  578. • A doListBox event is not generated when the user clicks list boxes in
  579.   a dialog box or desk accessory.  These events are handled
  580.   automatically.
  581.  
  582. Valid Polling Record Fields
  583. ```````````````````````````
  584. Poll.Window
  585. Poll.ListBox.Num
  586. Poll.ListBox.DoubleClick
  587.  
  588. ------------------------------------------------------------------------
  589.  
  590. doClick (event)
  591. ```````````````
  592. Indicator that the user has completed or in the midst of a click, double-click, triple-click, or drag.
  593.  
  594. A click, double-click, triple-click, or drag has been reported in the active window.  The event may still be in progress when PollSystem reports it, such as a double-click with the mouse button still down on the second click.  The Mouse part of the event record contains a field called What, which is the mouse event code that tells your application what type of mouse click has occurred.  The rest of the mouse record contains details on each mouse-down and mouse-up event.
  595.  
  596. A series of decisions are made by PollSystem to obtain single and multiple-click information, as well as drags.  Although they can be somewhat altered by your application (as explained later), the steps taken are as follows:
  597.  
  598.  1  The first mouse-down of a click is in the active window’s content
  599.     region, and is not in a button, picture button, scroll bar, editing
  600.     field, list box, pop-up menu or custom control.
  601.  
  602.  2  If no mouse-up event is in the queue, a “single-click, mouse still
  603.     down” mouse event code is returned.  If a mouse-up event is in the
  604.     queue, it is used to complete the click.
  605.  
  606.  3  If the time between the first mouse-down and the first mouse-up
  607.     (single-click) is too long to be the first click of a multiple
  608.     click, PollSystem returns with a “single-click completed” mouse
  609.     event code.
  610.  
  611.  4  If the time between the first mouse-down and the first mouse-up
  612.     (single-click) is short enough to constitute the first click of a
  613.     multiple click, PollSystem checks the event queue for a mouse-down
  614.     event that would be the beginning of a second click.  If a mouse-
  615.     down event is not found in time, PollSystem returns with a “single-
  616.     click completed” mouse event code.
  617.  
  618.  5  If a second mouse-down event is in the queue, it must be in the
  619.     active window’s content region, and must not be in a button, picture
  620.     button, scroll bar, editing field, list box, pop-up menu or custom
  621.     control.  If any of these conditions are violated, the mouse-down
  622.     event is left in the queue and PollSystem returns with a “single-
  623.     click completed” mouse event code.  If the conditions are not
  624.     violated, PollSystem continues.
  625.  
  626.  6  The second click has begun.  If no mouse-up event is in the queue, a
  627.     “double-click, mouse still down” mouse event code is returned.  If a
  628.     mouse-up event is in the queue, it is used to complete the click.
  629.  
  630.  7  If the time between the second mouse-down and the second mouse-up
  631.     (double-click) was too long to be the second click of a triple-
  632.     click, PollSystem returns with a “double-click completed” mouse
  633.     event code.
  634.  
  635.  8  If the time between the second mouse-down and the second mouse-up
  636.     (double-click) is short enough to constitute the second click of a
  637.     triple-click, PollSystem checks the event queue for a mouse-down
  638.     event that would be the beginning of a third click.  If a mouse-down
  639.     event is not found in time, PollSystem returns with a “double-click
  640.     completed” mouse event code.
  641.  
  642.  9  If a third mouse-down event is in the queue, it must be in the
  643.     active window’s content region, and must not be in a button, picture
  644.     button, scroll bar, editing field, list box, pop-up menu or custom
  645.     control.  If any of these conditions are violated, the mouse-down
  646.     event is left in the queue and PollSystem returns with a “double-
  647.     click completed” mouse event code.  If the conditions are not
  648.     violated, PollSystem continues.
  649.  
  650. 10  The third click has begun.  If no mouse-up event is in the queue, a
  651.     “triple-click, mouse still down” mouse event code is returned.  If a
  652.     mouse-up event is in the queue, it is used to complete the click and
  653.     return a “triple-click completed” mouse event code.
  654.  
  655.